//
//  ZSY_CityHunterCItyView.m
//  ZSY_BreadTrip
//
//  Created by 张诗宇 on 16/1/8.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "ZSY_CityHunterCItyView.h"

@implementation ZSY_CityHunterCItyView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews{
//    self.backgroundColor = [UIColor colorWithRed:81/255.0 green:189/255.0 blue:204/255.0 alpha:1];
    
    
    UIScrollView *scorll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 620)];
    scorll.backgroundColor = [UIColor colorWithRed:81/255.0 green:189/255.0 blue:204/255.0 alpha:1];
    [self addSubview:scorll];
    scorll.contentSize = CGSizeMake(WIDTH, HEIGHT*1.3);
    scorll.showsVerticalScrollIndicator = NO;
    
    
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(10, 630, WIDTH, 134);
    btn.backgroundColor = [UIColor colorWithRed:81/255.0 green:189/255.0 blue:204/255.0 alpha:1];
    btn.center = CGPointMake(WIDTH / 2, 630);
    [self addSubview:btn];
    [ btn setTitle:@"返回" forState:UIControlStateNormal];
    //    [btn setImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnaction:) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *changecity = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 100)];
    changecity.textAlignment = NSTextAlignmentCenter;
    changecity.font = [UIFont systemFontOfSize:20];
    changecity.backgroundColor = [UIColor colorWithRed:81/255.0 green:189/255.0 blue:204/255.0 alpha:1];
    changecity.textColor = [UIColor whiteColor];
    changecity.text = @"选择城市";
    [self addSubview:changecity];
    [changecity release];
    
    
    UILabel *dalian = [[UILabel alloc]initWithFrame:CGRectMake(20, 130, 100, 50)];
    dalian.font = [UIFont systemFontOfSize:16];
    dalian.textColor = [UIColor whiteColor];
    dalian.text = @"大连";
    [scorll addSubview:dalian];
    [dalian release];
    
    
    UILabel *dingwei = [[UILabel alloc]initWithFrame:CGRectMake(60, 130, 100, 50)];
    dingwei.font = [UIFont systemFontOfSize:14];
    dingwei.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.5];
    dingwei.text = @"GPS定位";
    [scorll addSubview:dingwei];
    [dingwei release];
    
    UILabel *remen = [[UILabel alloc]initWithFrame:CGRectMake(20, 180, 100, 50)];
    remen.font = [UIFont systemFontOfSize:14];
    remen.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.5];
    remen.text = @"热门城市";
    [scorll addSubview:remen];
    [remen release];
    
    
    UILabel *quanbu = [[UILabel alloc]initWithFrame:CGRectMake(20, 260, 100, 50)];
    quanbu.font = [UIFont systemFontOfSize:14];
    quanbu.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.5];
    quanbu.text = @"全部城市";
    [scorll addSubview:quanbu];
    [quanbu release];
    
    
    for (int i = 0; i < 25 ; i++) {
        UILabel *one = [[UILabel alloc]initWithFrame:CGRectMake(20, 295+(40*i), WIDTH - 40, 1)];
        one.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.6];
        [scorll addSubview:one];
        [one release];
    }
    
    
    
    UILabel *quanbu1 = [[UILabel alloc]initWithFrame:CGRectMake(20, 300, 100, 50)];
    quanbu1.font = [UIFont systemFontOfSize:15];
    quanbu1.textColor = [UIColor whiteColor];
    quanbu1.text = @"阿布扎比";
    [scorll addSubview:quanbu1];
    [quanbu1 release];
    
    
    UILabel *quanbu2 = [[UILabel alloc]initWithFrame:CGRectMake(20, 340, 100, 50)];
    quanbu2.font = [UIFont systemFontOfSize:15];
    quanbu2.textColor = [UIColor whiteColor];
    quanbu2.text = @"澳大利亚";
    [scorll addSubview:quanbu2];
    [quanbu2 release];
    
    UILabel *quanbu3 = [[UILabel alloc]initWithFrame:CGRectMake(20, 380, 100, 50)];
    quanbu3.font = [UIFont systemFontOfSize:15];
    quanbu3.textColor = [UIColor whiteColor];
    quanbu3.text = @"巴黎";
    [scorll addSubview:quanbu3];
    [quanbu3 release];
    
    
    UILabel *quanbu4 = [[UILabel alloc]initWithFrame:CGRectMake(20, 420, 100, 50)];
    quanbu4.font = [UIFont systemFontOfSize:15];
    quanbu4.textColor = [UIColor whiteColor];
    quanbu4.text = @"包头";
    [scorll addSubview:quanbu4];
    [quanbu4 release];
    
    UILabel *quanbu5 = [[UILabel alloc]initWithFrame:CGRectMake(20, 460, 100, 50)];
    quanbu5.font = [UIFont systemFontOfSize:15];
    quanbu5.textColor = [UIColor whiteColor];
    quanbu5.text = @"北京";
    [scorll addSubview:quanbu5];
    [quanbu5 release];
    
    UILabel *quanbu6 = [[UILabel alloc]initWithFrame:CGRectMake(20, 500, 100, 50)];
    quanbu6.font = [UIFont systemFontOfSize:15];
    quanbu6.textColor = [UIColor whiteColor];
    quanbu6.text = @"长沙";
    [scorll addSubview:quanbu6];
    [quanbu6 release];
    
    
    UILabel *quanbu7 = [[UILabel alloc]initWithFrame:CGRectMake(20, 540, 100, 50)];
    quanbu7.font = [UIFont systemFontOfSize:15];
    quanbu7.textColor = [UIColor whiteColor];
    quanbu7.text = @"成都";
    [scorll addSubview:quanbu7];
    [quanbu7 release];
    
    
    for (int i = 0; i < 4; i++) {
        UIButton *a = [UIButton buttonWithType:UIButtonTypeCustom];
        a.frame = CGRectMake(30+(80*i), 220, 70, 30);
        a.layer.cornerRadius = 15;
        //a.backgroundColor = [UIColor whiteColor];
        [scorll addSubview:a];
        a.layer.borderWidth = 1.f;//[UIColor whiteColor];
        a.layer.borderColor = [UIColor whiteColor].CGColor;
        if (i == 0) {
            [a setTitle:@"北京" forState:UIControlStateNormal];
        }else if(i == 1){
            [a setTitle:@"上海" forState:UIControlStateNormal];
        }else if(i == 2){
            [a setTitle:@"深圳" forState:UIControlStateNormal];
        }else{
            [a setTitle:@"广州" forState:UIControlStateNormal];
        }
        
        a.titleLabel.font = [UIFont systemFontOfSize:15];
    }
    
    
    
    
}

- (void)btnaction:(UIButton *)btn{
    [self.myDelegate back];
    
}



@end
